package cc.toprank.syncdatatask.util;

import java.util.Map;

public class CompareHelper {
	public static boolean compare(Map<String,Object> map1,Map<String,Object> map2) {  
		boolean result = true;
		if (map1 == null && map2 == null) return true;
		if (map1 == null && map2 != null) return false;
		if (map1 != null && map2 == null) return false; 
		if (map1.size() != map2.size()) return false;
		 
		for (Map.Entry<String, Object> entry :  map1.entrySet()) {
			String key1 = entry.getKey();
			Object value1 = entry.getValue(); 
			
			Object value2 = map2.get(key1);
			
			if (!value1.equals(value2)) {
				result = false; 
				break;
			} 
		}
		
		return result;
	}
	public static boolean compareObject(Object object,Object object2) {
		return object.equals(object2);
	}
}
